﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using FJASPX.Framwork.Helper;

namespace FJASPX.UI.Extention
{
    /// <summary>
    /// 最热商机
    /// </summary>
    public class ProductHandler : IHttpHandler
    {
        public bool IsReusable
        {
            get { return false; }
        }

        public void ProcessRequest(HttpContext context)
        {
            HttpRequest request = context.Request;
            HttpResponse respose = context.Response;
            StringBuilder sb = new StringBuilder();
            System.Data.DataTable datalist = PlugNT.Cms.Page.DataHelper.GetContentTable(10, "BusinessOpportunities", "commend,publish", "", "", false);
            if (datalist.Rows.Count > 0)
            {
                for (int i = 0; i <= datalist.Rows.Count - 1; i++)
                {
                    sb.Append("<li>");
                    sb.Append("<div class=\"pic\">");
                    sb.Append("<a href=\'" + datalist.Rows[i]["createpath"] + datalist.Rows[i]["pagename"] + ".shtml\'>");
                    sb.Append("<img src=\"" + datalist.Rows[i]["images"] + "\" /></a></div>");
                    sb.Append("<p>");
                    sb.Append("<a href=\'" + datalist.Rows[i]["createpath"] + datalist.Rows[i]["pagename"] + ".shtml\'>" + StringHelper.CutString(datalist.Rows[i]["title"].ToString(), 20) + "</a></p>");
                    sb.Append("<p class=\"px\">");
                    sb.Append(datalist.Rows[i]["description"] + "</p>");
                    //sb.Append("<a class=\"but\" href=\'" + datalist.Rows[i]["createpath"] + datalist.Rows[i]["pagename"] + ".shtml\'>" + datalist.Rows[i]["title"] + "</a></li>");
                    sb.Append("</li>");
                }


            }
            else
            {
                sb.Append("暂无最新消息！");
            }
            respose.Write(sb.ToString());
            respose.End();
        }
    }
}
